from django.db import models

# Create your models here.
from django.db import models
from django.utils import timezone
from django.db.backends.mysql.base import DatabaseFeatures # 关键设置
DatabaseFeatures.supports_microsecond_precision = False # 关键设置

# Create your models here.

def get_time():
    return timezone.localtime(timezone.now())

class Allfile(models.Model):
    file_name = models.CharField(max_length=100)
    file_path = models.CharField(max_length=300)
    file_size = models.FloatField(max_length=100)
    file_type = models.CharField(max_length=700)

    def __str__(self):
        return "文件名：%s\t 文件类型：%s\t 文件大小：%s" % (self.file_name, self.file_type, self.file_size)



class History(models.Model):
    text = models.CharField(max_length=3230)
    Ner = models.CharField(max_length=3230)
    Re = models.CharField(max_length=3230)
    add_time = models.DateTimeField(auto_now_add=True)
    Score = models.CharField(max_length=3230)
    #add_time = models.DateTimeField(default=get_time)
    # add_time = timezone.now().strftime("%Y-%m-%d %H:%M:%S")
    username = models.CharField(max_length=20)

    def __str__(self):
        return "具体查询内容：%s\t 查询时间：%s\t 用户名称：%s" % (self.text, self.add_time, self.username)


class Score(models.Model):
    score = models.CharField(max_length=100)
    text = models.CharField(max_length=300)

    def __str__(self):
        return "句子：%s\t 分数：%s\t " % (self.score, self.text)


class User(models.Model):
    username = models.CharField(max_length=100)
    password = models.CharField(max_length=300)

    def __str__(self):
        return "用户名：%s\t 密码：%s\t " % (self.username, self.password)

